<html>
<head>
<link href="../../../Objects/sofa_white.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div id="contenu">
		
		<center><h3>Creation of a Scene (1/9)</h3></center>	
		<center><img src="0_FullObject.png" width="300" name="FullObject" align="middle"></center>

		<br><div id="orangeText">Description</div>
		<p>The objective of this tutorial is to create a simulation with collisions between a deformable body and an obstacle. We will use some of the most common components of the SOFA framework trying not to enter into all the details related to the template selection. This will be done in another tutorial.<br>

		<p><div id="tutorialAction">Find the icon on the far left of the toolbar in the Modeler. It looks like a piece of paper with the corner folded, and its tool tip is <strong>New Tab</strong>. Press the button.</div></p>
        
        <p>This will give us a scene graph with some default components.</p>
 
        <p><div id="tutorialAction">Right click on the <strong>TreeCollisionGroupManager</strong> and select <strong>Delete</strong>.</div></p>
 
        <p>We don't need this component for our scene.</p>
        
        <div id="tutorialAction"><p>Find the <strong>OglModel</strong> component with the <strong>Filter</strong>, and drag and drop it onto the <strong>root</strong> node. Double click the <strong>OglModel</strong> node to edit its properties.</p>
        <p> Rename the model "Objective".</p>
        <p> Under the <strong>Property 2/3</strong> tab, find the <strong>fileMesh</strong> section. Click on the <strong>...</strong> button to bring up the file browser. Select the file <strong>/Sofa/share/mesh/dragon.obj</strong>, and press <strong>OK</strong> to return to the Modeler.</p></div>

		<p> We now have a scene with all the components needed to handle collisions in a scene, and a visual model representing our deformable object.</p>

		<div id="orangeText">Key points</div>
                <p>This is how the collisions are performed in SOFA using these default components.</p>
                <p><b>DefaultPipeline</b>: Launch all the operations to perform the collision detection and response

                <h4>Collision Detection:</h4> 
                <ol> 
                  <li><u>Broad Phase</u>: using "Axis Aligned Bounding Boxes" (AABB), we only keep potential colliding pair of objects</li>
                  <li><u>Narrow Phase</u>: we use the geometrical primitives (spheres, triangles, lines, points) to test the distance between two objects. <br>
                    we use the <b>BruteForceDetection</b> to select which primitives will be used, and the <b>MinProximityIntersection</b> to detect if a collision exists between two geometrical primitives</li>
                </ol>
                <h4>Collision Response:</h4>
                <ol> 
                  <li>With all the colliding primitives, we create an appropriate collision response: the <b>ContactManager</b> gives the information about what response we have to use. </li>
                  <li>Components are created dynamically in the graph to create repulsive forces, or constraints. In this tutorial, we will create <b>PenalityContactForceField</b>. </li>        
                </ol>
                </p>
               
                <p>Advanced collision detection and response are implemented in SOFA, so don't hesitate to experiment other examples.</p>

		<div id="orangeText">Results</div>
        
        		<p><div id="tutorialAction">Press the <strong>Run in SOFA</strong> (or press <strong>Ctrl-R</strong>), and press <strong>Animate</strong></div></p>
                
                <p>In this scene, we only have a <b>OglModel</b> corresponding to a pure visual representation of an object.<br> 
                Nothing happens.</p>

                <br><center><h3><a href="1_FullObject.scn">Next</a></center></h3>
	</div>
</body>
</html>
